package com.cn.lp.export.server.entity.convert;

import com.cn.lp.export.server.base.utils.JSONAide;

import javax.persistence.AttributeConverter;
import java.util.LinkedHashMap;

/**
 * Created by qirong on 2020/10/18.
 */
public class LinkedHashMapConvert implements AttributeConverter<LinkedHashMap, String> {

    @Override
    public String convertToDatabaseColumn(LinkedHashMap linkedHashMap) {
        return JSONAide.toJson(linkedHashMap);
    }

    @Override
    public LinkedHashMap convertToEntityAttribute(String s) {
        return JSONAide.toObject(s, LinkedHashMap.class);
    }
}
